<%-- 
    Document   : Home
    Created on : 04/08/2011, 12:42:06 PM
    UserType   : Web User
    Author     : Lan Ye 42239015
    Description: The home page when web user logs in. And the poll list will be displayed on home page.

--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../header.jsp" %>

    <div id="content-container">
        <div id="content">
               
            <h3 align="center">List of Polls</h3>
            <c:choose>   
                <c:when test="${not empty polls}">
                    <div id="tablecontainer">
                        <table class="gentable" cellpadding="3">
                            <tr>
                                <th>ID</th>
                                <th>Poll Name</th> 
                                <th>Details</th>
                                <th>Answer</th>

                            </tr>

                                <c:forEach items="${polls}" var="poll">
                                    <tr>
                                        <td>${poll.getId()}</a></td>
                                        <td>${poll.getName()}</td>
                                        <td><a href="<c:url value="view?pollID=${poll.getId()}"/>">Details</a></td>
                                        <td><a href="<c:url value="answer?pollID=${poll.getId()}"/>">Answer</a></td>
                                    </tr>

                                </c:forEach>

                        </table>
                    </div>
                </c:when>
            <c:otherwise>
                <p> No items for Polling! The poll in your account has not opened yet.</p>
            </c:otherwise>
            </c:choose>
         </div>  
       </div> 
        
    		
		
<%@ include file="../footer.jsp" %>
